package org.n.shop.service.impl;

import lombok.AllArgsConstructor;
import org.n.shop.domain.entity.Store;
import org.n.shop.mapper.StoreMapper;
import org.n.shop.result.RestResult;
import org.n.shop.result.RestResultBuilder;
import org.n.shop.service.StoreService;
import org.n.shop.util.MinioUtil;
import org.springframework.stereotype.Service;

@Service
@AllArgsConstructor
public class StoreServiceImpl implements StoreService {
    private StoreMapper storeMapper;
    private MinioUtil minioUtil;

    @Override
    public RestResult selectById(int id) {
        Store store = storeMapper.selectById(id);
        store.setIntroduce(minioUtil.getObject(store.getIntroduce()));
        return new RestResultBuilder().success(store);
    }
}
